

#ifndef _CLEAN_CAN_MSG_H_
#define _CLEAN_CAN_MSG_H_

#include "stdint.h"
#include "can_msg_hdl.h"


#define ID_CAN_CLEAN_FAULT_CODE   0x1C308101

typedef union
{
	struct
	{
		uint32_t code_X1;
		uint32_t code_X2;
	};
	
	uint8_t data[8];

}STR_CLEAN_FLT_CODE;



#define ID_CAN_CLEAN_RUN_TIME     0x1C308102



#define ID_CAN_CLEAN_RUN_STATUS   0x1C308103

typedef union
{
	struct
	{
		uint32_t fan_runtime;
		
		uint8_t                  :2;
		uint8_t  brush_FSM       :2;
		uint8_t  dusfan_FSM      :2;
		uint8_t  brush_lift_FSM  :2;
		
		uint8_t  water_lift_FSM  :2;
		uint8_t  brush_right_FSM :2;
		uint8_t                  :4;
		
		uint8_t                  :8;
		
		uint8_t                  :2;
		uint8_t  set_brush       :1;
		uint8_t  remove_brush    :1;
		uint8_t  add_agent       :1;
		uint8_t                  :3;
	
	};
	
	uint8_t data[8];


}STR_CLEAN_STATUS;


#define ID_CAN_CLEAN_BAT_INFO     0x1C308104


#define ID_CAN_CLEAN_SYSTEM       0x1C308105

typedef union
{
	struct
	{
		uint32_t code_X3;
		uint32_t sys_runtime;
	};
	
	uint8_t data[8];


}STR_CLEAN_SYS_TIME;


#define ID_CAN_CLEAN_CURRENT_X1   0x1C308106


typedef union
{
	struct
	{
		uint32_t code_X4;
		uint32_t reserve;
	};
	
	uint8_t data[8];

}STR_CLEAN_CURRENT_X1;



#define ID_CAN_CLEAN_CURRENT_X2   0x1C308107

typedef union
{
	struct
	{
		uint32_t brush;
		uint32_t dustfan;
	};
	
	uint8_t data[8];
	

}STR_CLEAN_CURRENT_X2;



#define ID_CAN_CLEAN_OUTPUT_FSM   0x1C308108


typedef union
{

	struct
	{
		uint32_t reserve;
		
		uint8_t  :6;
		uint8_t  waste_full   :2;
		
		uint8_t  water_full   :2;
		uint8_t  waste_empty  :2;
		uint8_t  agent_level  :2;
		uint8_t  sink_full    :2;
		
		uint8_t  reserve2;
		
		uint8_t  :2;
		uint8_t  water_level:3;
		uint8_t  :3;
	
	};
	
	uint8_t data[8];


}STR_CLEAN_SENSOR;



typedef struct
{
	
	STR_CLEAN_FLT_CODE   fault_X1X2;
	STR_CLEAN_SYS_TIME   fault_X3;
	STR_CLEAN_CURRENT_X1 fault_X4;
	
	STR_CLEAN_CURRENT_X2 current;
	
	STR_CLEAN_STATUS status;
	STR_CLEAN_SENSOR sensor;
	
	uint16_t rece_cnt;

}STR_CLEAN_CANMSG;


extern STR_CLEAN_CANMSG  cleanMsgRec;

extern void clean_rece_canmailbox_set(uint8_t fifo_num);




// -----------------------------------  clean device ctrl --------------------------------------


#define ID_CAN_CLEAN_CTRL        0x1C308100

typedef union
{
	struct
	{
		uint64_t en_brush       :1;
		uint64_t en_dustfan     :1;
		uint64_t en_pump_water  :1;
		uint64_t en_pump_agent  :1;
		uint64_t level_press    :8;
		uint64_t level_water    :8;
		uint64_t dir_pump_waste :2;
		uint64_t pwm_pump_waste :8;
		uint64_t                :34;
	
	};
	
	uint8_t data[8];

}STR_CLEAN_CTRL;

extern STR_CLEAN_CTRL    cleanMsgCtrl;



extern void clean_ctrl_msg_store(STR_CAN_MESSAGE *can_msg);


#endif









